package finance

class Instrument {
    String name
    String symbol
    InstrumentType instrumentType
    Date added = new Date()
    Datasource source


    static constraints = {
      name(unique:true, blank:false)
      symbol(unique:true, blank:false)
      source(blank:false)
    }

    static mapping = {
      instrumentType lazy:false
    }

    static hasMany = [ contains:Instrument, 
		values:FieldValue, 
		orderInfo : OrderInfo]

    String toString() {
      "${name} ${symbol}"
    }
}
